package com.horoscope.astrology.zodiac.signs.free.network

import com.horoscope.astrology.zodiac.signs.free.bean.*
import io.reactivex.Observable
import retrofit2.http.*

/**
 * Rtrofit①
 * 定义Api接口
 * https://www.getpostman.com/collections/bd79c5638574f6cb149f
 * */
interface ApiCenter {


    /**
     * 请求方法格式
     * @其它声明
     * @请求方式（请求地址【填写基础请求路径baseUrl后续的部分即可】）
     * fun 请求方法名(请求参数)：Observable<请求返回的实体>
     * */
    @FormUrlEncoded //post固定
    @POST("post_info")
    fun postFCMInfo(
        @Field("udid") udid: String,
        @Field("fcm_token") token: String,
        @Field("horoscope") horoscope: String,
        @Field("timezone") timezone: String
    ): Observable<FCMResultBean>

    // 请求参数是以“?key=vale%key=value...”方式拼接到地址后面的，假如你需要的是以"/value"的方式拼接到地址后面
    // （restful模式？），那么可以通过@Path注解来实现：
    @GET("relationship_compatibility")
    fun getRelationResult( // 一次性传入参数可以用 @QueryMap map:Map<String, String>
        @Query("udid") udid: String,
        @Query("name1") name1: String,
        @Query("birthday1") birthday1: String,
        @Query("gender1") gender1: String,
        @Query("name2") name2: String,
        @Query("birthday2") birthday2: String,
        @Query("gender2") gender2: String
    ): Observable<RelationResultBean>

    @GET("birth_chart")
    fun getBirthChart(
        @Query("udid") udid: String,
        @Query("name") name: String,
        @Query("north") north: String,
        @Query("west") west: String,
        @Query("offset") offset: Int,
        @Query("birthday") birthday: String,
        @Query("born_place") bornPlace: String,
        @Query("timezone") timezone: String
    ): Observable<BirthChartResultBean>


    @GET("searchJSON")
    fun getCityResult(
        @Query("name_startsWith") startWith: String,
        @Query("featureClass") featureClass: String,
        @Query("style") style: String,
        @Query("maxRows") maxRows: Int,
        @Query("username") username: String,
        @Query("lang") lang: String
    ): Observable<CityResultBean>


    @GET("data")
    fun getMainHoroscope(
        @Query("horoscope") horoscope: String
    ): Observable<DataResultBean>

    @GET("home")
    fun getHoroscopeData(
        @Query("horoscope") horoscope: String
    ): Observable<HoroscopeDataBean>

    @GET("zodiac_compatibility")
    fun getZodiacCompatibility(
        @Query("horoscope1") horoscope1: String,
        @Query("horoscope2") horoscope2: String
    ): Observable<ZodiacResultBean>

    @GET("love_compatibility")
    fun getLoveCompatibility(
        @Query("horoscope1") horoscope1: String,
        @Query("horoscope2") horoscope2: String
    ): Observable<LoveResultBean>

    @GET("get_data")
    fun getHoroscope(
        @Query("udid") udid: String,
        @Query("gender") gender: String,
        @Query("birthday") birthday: String,
        @Query("marial_status") marry: String
    ): Observable<DataResultBean>

    @GET("ad_config")
    fun getConfig(

    ): Observable<ConfigResultBean>

    @GET("get_quiz")
    fun getQuiz(
        @Query("type") type: String,
        @Query("page") page: String
    ): Observable<QuizResultBean>

    @GET("name_compatibility")
    fun getNameCompatibility(
        @Query("name1") name1: String,
        @Query("name2") name2: String
    ): Observable<NameResultBean>

    @GET("numerology")
    fun getNumerology(
        @Query("udid") udid: String,
        @Query("gender") gender: String,
        @Query("birthday") birthday: String,
        @Query("marial_status") status: String
    ): Observable<NumBerResultBean>

    @GET("get_news")
    fun getNews(
        @Query("category") category: String,
        @Query("page") page: String
    ): Observable<ArticleResultBean>

    @GET("push_news")
    fun getPushNew(): Observable<PushNewBean>


    @FormUrlEncoded
    @POST("post_coin")
    fun postCoin(
        @Field("data") data: String
    ): Observable<BaseBean>

    @FormUrlEncoded
    @POST("user")
    fun postUser(
        @Field("data") data: String
    ): Observable<BaseBean>

    @FormUrlEncoded
    @POST("user")
    fun postUser(
        @Field("udid") udid: String,
        @Field("name") name: String,
        @Field("gender") gender: String,
        @Field("birthday") birthday: String,
        @Field("born_place") place: String,
        @Field("marial_status") status: String
    ): Observable<BaseBean>


    @FormUrlEncoded
    @POST("personal_information")
    fun postPersonInfoWithDrawal(
        @Field("data") data: String
    ): Observable<BaseBean>


    @FormUrlEncoded
    @POST("get_signin")
    fun postSign(
        @Field("udid") udid: String,
        @Field("invite_code") code: String,
        @Field("is_double") is_double: String
    ): Observable<BaseBean>

    @FormUrlEncoded
    @POST("heartbeat")
    fun postCollectInfo(
        @Field("charge") charge: Int,
        @Field("udid") udid: String,
        @Field("brightness") brightness: Float,
        @Field("gyroscope") gyroscope: String,
        @Field("wifi") wifi: Int

    ): Observable<BaseBean>

    // 上传title
    @FormUrlEncoded //post固定
    @POST("post_reading")
    fun postArticleTitle(
        @Field("udid") udid: String,
        @Field("title") token: String
    ): Observable<BaseBean>

    // 更新Profile整体
    @FormUrlEncoded
    @POST("update_user")
    fun postUpdateUser(
        @Field("udid") udid: String,
        @Field("name") name: String,
        @Field("gender") gender: String,
        @Field("birthday") birthday: String,
        @Field("born_place") born_place: String,
        @Field("marital_status") marital_status: String
    ): Observable<BaseBean>

    // 更新Profile单个字段
    @FormUrlEncoded
    @POST("update_user")
    fun postUpdateUserForKey(
        @Field("udid") udid: String,
        @Field("type") type: String,
        @Field("info") info: String
    ): Observable<BaseBean>

    //通过通知里的url的article_id请求文章(也可以当做通用两个链接参数)
    @GET("{article}/{url}")
    fun getArticleForPushUrl(
        @Path("article") article: String,
        @Path("url") url: String
    ): Observable<PushNewBean>

    //通过通知里的url的article_id请求文章(也可以当做通用两个链接参数)
    @GET("{quizid}/{url}")
    fun getQuizForPushUrl(
        @Path("quizid") article: String,
        @Path("url") url: String
    ): Observable<QuizResultBean>

    // 获取每日数字具体释义
    @GET("numerology_text")
    fun getNumberText(
        @Query("type") type: Int,
        @Query("number") number: Int
    ): Observable<NumerologyBean>

    // 获取首页星座图内容
    @GET("character")
    fun getcharacter(
        @Query("horoscope") horoscope: String
    ): Observable<CharacterBean>

    // 手相
    @GET("{quizid}/{url}")
    fun getPalmScanResult(
        @Path("quizid") article: String,
        @Path("url") url: String
    ): Observable<HandBean>

}